

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="" charset="utf-8">
<link rel="stylesheet" type="text/css" href="JTrac_files/layout.css">
<title>Test online</title>

<script type="text/javascript">

var mins="${testInformation.countTime}";


//calculate the seconds (don't change this! unless time progresses at a different speed for you...)
//var secs = mins*60;
var secs=mins*60;
function countdown() {
	setTimeout('Decrement()',1000);
}

function Decrement() {
	if (document.getElementById) {
		minutes = document.getElementById("minutes");
		seconds = document.getElementById("seconds");
		// if less than a minute remaining
		if (seconds < 59) {
			seconds.value = secs;
		} else {
			minutes.value = getminutes();
			seconds.value = getseconds();
		}
		secs--;
		
		if (mins==0 && secs<0){ 
			document.getElementById("finish").disabled = true;
			return 0;}
		setTimeout('Decrement()',1000);
		
	}
}
function getminutes() {
	// minutes is seconds divided by 60, rounded down
	mins = Math.floor(secs / 60);
	return mins;
}
function getseconds() {
	// take mins remaining (as seconds) away from total seconds remaining
	return secs-Math.round(mins *60);
}


</script>

</head>
<body>
	<div id="wrapper">
		<%@include file="template.jsp"%>

		<div id="cauhoi">
		<!--  -->
			<div id="time" >

				<!--  <input type="button" id="finish" value="Finish"
					onclick="disable(this.id)" /></br>-->
				<div id="timer" align="center">
					Your times: <input id="minutes" type="text"
						style="width: 14px; border: 1; background-color: red; font-size: 16px; font-weight: bold;">
					minutes and <input id="seconds" type="text"
						style="width: 26px; border: 1; background-color: red; font-size: 16px; font-weight: bold;">
					seconds.
					<div>
						<!--<s:form action="cancel">
							<s:submit value="Cancel" align="center"></s:submit>
						</s:form>-->
					</div>
				</div>


			</div>
			<!--  -->
			<div class="title">
				<h2 style="color: white;">TEST PAGE</h2>
			</div>
			<div class="noidung">
			  <s:form action="finish" id="formFinish" class="formFinish" name="formFinish">
				<table width="635" border="1" cellpadding="0" cellspacing="0">
					<tr bgcolor="#483D8B">
						<td align="center" style="color: white;">ID</td>
						<td align="center" style="color: white;">Questions</td>
					</tr>
					<ol>
						<s:iterator value="listStructTest">
							<tr bgcolor="#696969">
								<td align="center"><s:property value="question.questionId"/> </td>
								<td align="center"><s:property value="question.questionText"/></td>
							
								<ol>
						          <s:iterator value="listAnswer" >
						             
						             <s:checkboxlist name="choiceAnswer" list="answerText"></s:checkboxlist>
						      
						          </s:iterator>
						         
						        </ol>
						        
						    </tr>
						</s:iterator>
					</ol>
				</table>
				<s:hidden name="resultIdBean" value="%{resultId}"  />
				<s:hidden name="userNameBean" value="%{testInformation.userName}"></s:hidden>
				
				<s:submit value="finish" id="finish" ></s:submit>
			
				
				<!-- javacript -->
					<script type="text/javascript">
					    countdown();
					   //document.getElementById("finish").disabled = true;
					</script>
				</s:form>
			</div>

		</div>


	</div>
	
	


</body>
</html>